import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { asyncAddNum,addNum } from './store/slice/countSlice'

export default function App() {
    const dispatch = useDispatch()
    let {num} = useSelector(state=>state.count)
    return (
        <div>
            <p>num: {num}</p>
            <p><button onClick={()=>{
                dispatch(addNum(5));
            }}>同步+</button></p>

            <p><button onClick={()=>{
                dispatch(asyncAddNum(3));
            }}>异步加</button></p>
        </div>
    )
}
